package org.ihelpuoo.weboo.security;

import org.ihelpuoo.orm.Entity;
import org.ihelpuoo.orm.filter.CharFieldFilter;
import org.ihelpuoo.orm.filter.FieldFilter;

public abstract class Account extends Entity
{

	public Account()
	{
		super();
	}

	protected String	name;
	private String		password;

	private FieldFilter	_pwdff;
	private FieldFilter	_defff;

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public String getPassword()
	{
		return password;
	}

	public void setPassword(String password)
	{
		this.password = password;
	}

	public FieldFilter getQueryActivedFieldFilter()
	{
		if (null == _defff)
		{
			_defff = new CharFieldFilter("[id][name][password]");
		}
		return _defff;
	}

	public FieldFilter getPasswordActivedFieldFilter()
	{
		if (null == _pwdff)
		{
			_pwdff = new CharFieldFilter("[password]");
		}
		return _pwdff;
	}

	@Override
	public String toString()
	{
		return new StringBuffer("[").append(id).append(']').append(name).toString();
	}

	@Override
	public boolean equals(Object obj)
	{
		if (null == name || null == password || obj == null)
			return false;
		return id == ((Account)obj).id && name.equals(((Account)obj).name)
				&& password.equals(((Account)obj).password);
	}

}
